import {rolelist} from "../../../request/api"


//封装接口类型
interface StateRole {
   roleList:Array<object>
}
const state ={
    roleList:[]

}

const getters ={
    getRole(state:StateRole){
        return state.roleList
    }
}

const mutations ={
    REQ_ROLELIST(state:StateRole,payload:any){
        state.roleList =  payload
    }

}

const actions = {
    getRoleAction(context:any){
      rolelist().then(res=>{
        // console.log(res);
        context.commit("REQ_ROLELIST",res.list)
      })
    }

}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}
